import React, { Component } from 'react'
import DepartmentList from './_base/DepartmentList'
import { connect } from 'react-redux'
import { getAllDepartmentListAsync } from '../../../_redux/actions_async'

class AdminAllDepartmentPage extends Component {
  constructor (props) {
    super(props)
  }

  componentWillMount () {
    this.props.getAllDepartmentListAsync()
  }

  render () {
    return (
      <div>
        <DepartmentList departmentList={this.props.allDepartmentList}/>
      </div>
    )
  }
}

AdminAllDepartmentPage.propTypes = {}

AdminAllDepartmentPage = connect(
  ({ $AdminPageState: { allDepartmentList } }) => ({ allDepartmentList }),
  { getAllDepartmentListAsync }
)(AdminAllDepartmentPage)

export default AdminAllDepartmentPage
